package com.fanyouzhao.ssm251.factory;

import com.fanyouzhao.ssm251.pojo.User;

/**
 * @Author: fanyouzhao
 * @Date: 15:09 2021/5/24
 */
//创建User工厂
public class UserFactory {
    /*获取User实例*/
    public User newInstance() {
        User user = new User();
        user.setName("Tom");
        return user;
    }

    /*获取User实例，静态方法*/
    public static User newInstance2() {
        User user = new User();
        user.setName("Jerry");
        return user;
    }
}
